#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>
using namespace std;

int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) {
	vector<int> dp(obstacleGrid[0].size());
	bool t = true;
	for (int i = 0; i < obstacleGrid.size(); i++) {
		for (int j = 0; j < obstacleGrid[0].size(); j++) {
			if (obstacleGrid[i][j] == 1) {
				dp[j] = 0;
				if (j == 0) {
					t = false;
				}
			}
			else if (j == 0) {
				if (t == false) {
					dp[j] = 0;
				}
				else dp[j] = 1;
			}
			else {
				dp[j] += dp[j - 1];
			}
		}
	}
	return dp[obstacleGrid.size() - 1];
}
int main()
{
	vector<vector<int>> v = { {0, 0} };
	cout << uniquePathsWithObstacles(v);
}